package net.aiform.account.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import net.aiform.pojo.Identity;

@Entity
@Table(name = "af_person")
public class Person extends Identity implements Serializable {
	private static final long serialVersionUID = 3677095572040861986L;
	private String createIp;
	private String accountEmail;
	private String password;
	private String nickName;
	private String firstname;
	private String lastname;
	private int sex;
	private Date birthday;
	private String timezone;
	private String local;
	private String lastIp;
	private Date lastTime;
	@OneToMany(mappedBy = "person", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private Set<Contact> contacts;

	public void addContact(Contact contact) {
		if (!this.contacts.contains(contact)) {
			this.contacts.add(contact);
			contact.setPerson(this);
		}
	}

	public Date getBirthday() {
		return birthday;
	}

	public Set<Contact> getContacts() {
		return contacts;
	}

	public String getLastIp() {
		return lastIp;
	}

	public Date getLastTime() {
		return lastTime;
	}

	public String getLocal() {
		return local;
	}

	public String getNickName() {
		return nickName;
	}

	public String getPassword() {
		return password;
	}

	public int getSex() {
		return sex;
	}

	public String getTimezone() {
		return timezone;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public void setContact(Set<Contact> contacts) {
		this.contacts = contacts;
	}

	public void setLastIp(String lastIp) {
		this.lastIp = lastIp;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public void setLocal(String local) {
		this.local = local;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}

	public void setTimezone(String timezone) {
		this.timezone = timezone;
	}

	public String getFirstname() {
		return firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	public void setContacts(Set<Contact> contacts) {
		this.contacts = contacts;
	}

	public String getCreateIp() {
		return createIp;
	}

	public void setCreateIp(String createIp) {
		this.createIp = createIp;
	}

	public String getAccountEmail() {
		return accountEmail;
	}

	public void setAccountEmail(String accountEmail) {
		this.accountEmail = accountEmail;
	}

}
